package cn.sunzq.springdata.elasticsearch.demo.base.response;


public class BizException extends RuntimeException{

	private static final long serialVersionUID = 1L;
	
	protected int errorCode;
	protected String errorMessage;
	
	public BizException() {
		super();
	}
	public BizException(String errorMessage) {
		super();
		this.errorMessage = errorMessage;
	}
	public BizException(int errorCode, String errorMessage) {
		super();
		this.errorCode = errorCode;
		this.errorMessage = errorMessage;
	}
	
	public BizException(BizErrorEnum bizError) {
		super();
		this.errorCode = bizError.getErrorCode();
		this.errorMessage = bizError.getErrorMessage();
	}
	
	public BizException(BizErrorEnum bizError, String detailMessage) {
		super();
		this.errorCode = bizError.getErrorCode();
		this.errorMessage = bizError.getErrorMessage() + detailMessage;
	}
	
	public int getErrorCode() {
		return errorCode;
	}
	public void setErrorCode(int errorCode) {
		this.errorCode = errorCode;
	}
	public String getErrorMessage() {
		return errorMessage;
	}
	public void setErrorMessage(String errorMessage) {
		this.errorMessage = errorMessage;
	}
	
	@Override
	public String toString() {
		return "BizException [ errorCode-" + errorCode + ", errorMessage-" + errorMessage + "]";
	}
}
